package com.mxf.code.controller;

import com.mxf.code.entity.LoginUserEntity;
import com.mxf.code.service.LoginService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class LoginController {
    @Autowired
    private LoginService loginService;
 
 
    @PostMapping("/login")
    public String login(@RequestBody LoginUserEntity loginUser) {
        String token = loginService.loginSys(loginUser);
        log.info("用户 {} 登录成功", loginUser.getUsername());
        return token;
    }
 
    @GetMapping("/test/page")
    public String testPage() {
        return "test page";
    }
}